#pragma one
#include <iostream>
#include <pthread.h>
#include"Mutex.hpp"

namespace CondModule
{
    using namespace LockModule;
    class cond
    {
        public:
        cond()
        {
            pthread_cond_init(&_cond,nullptr);
        }
        void wait(Mutex &mutex)
        {
            pthread_cond_wait(&_cond,mutex.LockPtr());
        }
        void NotifyAll()
        {
            pthread_cond_broadcast(&_cond);
        }
        ~cond()
        {
            pthread_cond_destroy(&_cond);
        }
        private:
        pthread_cond_t _cond;
    };
};
